<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .activated{
            color:red;
        }
    </style>
</head>
<body>
    <div id="app">
        <div @click="handleDivClick" :class="{activated: isActivated}">hello world</div><!-- class对象绑定 -->
        <!-- <div @click="handleDivClick" :class="[activated]">hello world</div> --><!-- 数组绑定 -->
        <div :style="styleObj" @click="handle">来了</div><!-- 内联样式 -->
    </div>
    <script>
        var app=new Vue({
            el:"#app",
            data:{
                isActivated:false,
                //数组绑定:activated:''
                styleObj:{/* 内联样式 */
                    color:"black"
                }
            },
            methods:{
                handleDivClick:function(){
                    this.isActivated=!this.isActivated
                    //数组绑定:this.activated=this.activated==="activated" ? " " : "activated"
                },
                handle:function(){/* 内联样式 */
                    this.styleObj.color=this.styleObj.color==="black"?"red":"black"
                }
            }
        })
    </script>
</body>
</html>